package com.itheima.mapper;

import com.github.pagehelper.Page;
import com.itheima.pojo.OperateLog;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

// 进行各种统计的数据访问层
@Mapper
public interface ReportMapper {
    // 指定map中job这列的不重复的
    @MapKey("job")
    List<Map<String, Object>> empJobData();

    @MapKey("name")
    List<Map> empGenderData();

    /**
     * 统计班级人数
     */
    @Select("select c.name cname , count(s.id) scount from clazz c  left join student s on s.clazz_id = c.id group by c.name order by count(s.id) desc ")
    List<Map<String,Object>> getStudentCount();

    /**
     * 统计学员学历
     */
    @MapKey("name")
    List<Map> countStudentDegreeData();

    Page<OperateLog> getLogs(Integer page, Integer pageSize);
}
